import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/red_packet_decoration_entity.g.dart';
import 'dart:convert';
import 'content_data.dart';

@JsonSerializable()
class RedPacketDecorationEntity extends ContentData {
  int? layout = 0;
  @JSONField(name: "hide_empty_coupon")
  String? hideEmptyCoupon = '';
  @JSONField(name: "red_packet")
  List<RedPacketDecorationRedPacket>? redPacket = [];

  @JSONField(name: "coupon_style")
  int? couponStyle = 0;
  String? uuid = '';

  RedPacketDecorationEntity() {
    type = 'red_packet';
  }

  factory RedPacketDecorationEntity.fromJson(Map<String, dynamic> json) => $RedPacketDecorationEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $RedPacketDecorationEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return RedPacketDecorationEntity.fromJson(json);
  }
}

@JsonSerializable()
class RedPacketDecorationRedPacket {
  String? getLimit = '';
  String? discountDetails = '';
  String? name = '';
  int? surplusNum = 0;
  String? couponId = '';
  String? marketingId = '';
  String? goodsType = '';
  int? status = 0;

  RedPacketDecorationRedPacket();

  factory RedPacketDecorationRedPacket.fromJson(Map<String, dynamic> json) => $RedPacketDecorationRedPacketFromJson(json);

  Map<String, dynamic> toJson() => $RedPacketDecorationRedPacketToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
